package com.ledtechdesign.service;

import com.ledtechdesign.beans.Account;
import com.ledtechdesign.service.api.AFCSAPIDigesterResult;
import com.ledtechdesign.service.api.AFCSAPIXMLResult;
import com.ledtechdesign.service.api.IAFCSServiceResult;

public enum ServiceManagerEnum {

	OBJECT("object"), XML("xml");

	private String name;

	ServiceManagerEnum(String n) {
		this.name = n;
	}

	public IAFCSService<? extends IAFCSServiceResult> get(Account account) {
		switch (this) {
		case XML:
			// TODO cast to XML

			return new AFCSDefaultService<AFCSAPIXMLResult>(account,
					new AFCSAPIXMLResult());
		case OBJECT:
			return new AFCSDefaultService<AFCSAPIDigesterResult>(account,
					new AFCSAPIDigesterResult());
		default:
			return new AFCSDefaultService<AFCSAPIDigesterResult>(account,
					new AFCSAPIDigesterResult());
		}
	}

	@Override
	public String toString() {
		return this.name;
	}

}
